// vue.config.js

/**
 * @type {import('@vue/cli-service').ProjectOptions}
 */
module.exports = {
  publicPath: process.env.NODE_ENV === "production" ? "/demo-main-vue/" : "/",
  devServer: {
    headers: {
      "Access-Control-Allow-Origin": "*",
      // "Access-Control-Allow-Headers": "*",
      // "Access-Control-Allow-Methods": "*",
      // "Access-Control-Allow-Credentials": true,
    },
    proxy: {
      "/api_basedata/": {
        target: "http://localhost:8888",
        changeOrigin: true,
        // bypass: function (req, res, proxyOptions) {
        //   console.log("----api_basedata res----");
        // },
      },
      "/api_wzh": {
        target: "http://localhost:8888", // 无纸化病案
        ws: true,
        changeOrigin: true,
        pathRewrite: {
          "^/api_wzh": "",
        },
        // bypass: function (req, res, proxyOptions) {
        //   console.log("----api_wzh res----");
        // },
      },
      "/api": {
        target: "http://localhost:8888", // 无纸化病案-api
        ws: true,
        changeOrigin: true,
        // bypass: function (req, res, proxyOptions) {
        //   console.log("----api res----");
        // },
      },
    },
    open: process.env.NODE_ENV === "development",
    port: "8000",
  },
  transpileDependencies: ["sockjs-client"],
};
